import os
from pygame import Rect


class Settings:
    # 游戏设置
    FPS = 60  # 游戏帧率
    GAME_NAME = "坦克大战"  # 游戏标题
    BOX_SIZE = 50  # 单位屏幕大小
    BOX_RECT = Rect(0, 0, BOX_SIZE, BOX_SIZE)  # 单位屏幕矩形
    SCREEN_RECT = Rect(0, 0, BOX_SIZE * 19, BOX_SIZE * 13)  # 屏幕矩形
    SCREEN_COLOR = (0, 0, 0)  # 屏幕颜色

    # 通用变量
    LEFT = 0
    RIGHT = 1
    UP = 2
    DOWN = 3

    # 地图
    # 0表示空白、1表示红墙、2表示铁墙、3表示草、4表示海、5表示鸟
    RED_WALL = 1
    IRON_WALL = 2
    WEED_WALL = 3
    WATER_WALL = 4
    home_WALL = 5
    MAP_ONE = [
        [0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, ],
        [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, ],
        [0, 1, 0, 0, 1, 3, 3, 1, 1, 2, 1, 1, 3, 3, 1, 0, 0, 1, 0, ],
        [0, 1, 0, 0, 1, 3, 3, 1, 1, 2, 1, 1, 3, 3, 1, 0, 0, 1, 0, ],
        [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, ],
        [0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, ],
        [1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, ],
        [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, ],
        [0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, ],
        [0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, ],
        [0, 1, 3, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 1, 0, ],
        [0, 1, 3, 3, 3, 1, 0, 0, 1, 1, 1, 0, 0, 1, 3, 3, 3, 1, 0, ],
        [0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, ],
    ]

    # 音频
    BOOM_MUSIC = "resources/musics/boom.wav"
    FIRE_MUSIC = "resources/musics/fire.wav"
    HIT_MUSIC = "resources/musics/hit.wav"

    # 坦克类型
    player = 0
    ENEMY = 1

    # 我方坦克各种图片
    player_IMAGE_NAME = "./resources/images/player/Full_player1U.gif"
    player2_IMAGE_NAME = "./resources/images/player/Full_player2U.gif"
    Full_player_IMAGES = {
        LEFT: "./resources/images/player/Full_player1L.gif",
        RIGHT: "./resources/images/player/Full_player1R.gif",
        UP: "./resources/images/player/Full_player1U.gif",
        DOWN: "./resources/images/player/Full_player1D.gif"
    }
    part_player_IMAGES = {
        LEFT: "./resources/images/player/part_player1L.gif",
        RIGHT: "./resources/images/player/part_player1R.gif",
        UP: "./resources/images/player/part_player1U.gif",
        DOWN: "./resources/images/player/part_player1D.gif"
    }
    Full_player2_IMAGES = {
        LEFT: "./resources/images/player/Full_player2L.gif",
        RIGHT: "./resources/images/player/Full_player2R.gif",
        UP: "./resources/images/player/Full_player2U.gif",
        DOWN: "./resources/images/player/Full_player2D.gif"
    }
    part_player2_IMAGES = {
        LEFT: "./resources/images/player/part_player2L.gif",
        RIGHT: "./resources/images/player/part_player2R.gif",
        UP: "./resources/images/player/part_player2U.gif",
        DOWN: "./resources/images/player/part_player2D.gif"
    }

    player_SPEED = 2
    player2_SPEED = 2
    home_IMAGE = "./resources/images/walls/5.png"# 我方小鸟
    player_LIFE = 2


    # 敌方坦克,小绿第一级
    ENEMY_IMAGES = {
        LEFT: "./resources/images/enemy/enemy2L.gif",
        RIGHT: "./resources/images/enemy/enemy2R.gif",
        UP: "./resources/images/enemy/enemy2U.gif",
        DOWN: "./resources/images/enemy/enemy2D.gif"
    }
    ENEMY_COUNT = 10
    ENEMY_SPEED = 1

    # 小红第二级
    ENEMY_IMAGES2 = {
        LEFT: "./resources/images/enemy/enemy1L.gif",
        RIGHT: "./resources/images/enemy/enemy1R.gif",
        UP: "./resources/images/enemy/enemy1U.gif",
        DOWN: "./resources/images/enemy/enemy1D.gif"
    }
    ENEMY_COUNT2 = 5
    ENEMY_SPEED2 = 2

    #小蓝第三级
    ENEMY_IMAGES3 = {
        LEFT: "./resources/images/enemy/enemy3L.gif",
        RIGHT: "./resources/images/enemy/enemy3R.gif",
        UP: "./resources/images/enemy/enemy3U.gif",
        DOWN: "./resources/images/enemy/enemy3D.gif"
    }
    ENEMY_COUNT3 = 3
    ENEMY_SPEED3 = 2
    # 子弹
    BULLET_IMAGE_NAME = "./resources/images/bullet/bullet.png"
    BULLET_RECT = Rect(0, 0, 5, 5)
    BULLET_SPEED = 4

    WALLS = [
        f"resources/images/walls/{file}" for file in os.listdir(
            "../TankBettle(1)/TankBettle(1)/resources/images/walls/")
    ]

    # 爆炸的图片
    BOOMS = [
        "resources/images/boom/" + file for file in os.listdir("../TankBettle(1)/TankBettle(1)/resources/images/boom")
    ]
    Clear = "resources/images/blast9.gif"
    PROP = "./resources/images/props/prop3.gif"
    PROP2 = "./resources/images/props/prop4.gif"
